Skip to content

qwen3_5_moe: guard new cudaMemGetInfo blocks behind EXECUTORCH_BUILD_CUDA#19265

Merged
rascani merged 1 commit intopytorch:mainfrom
rascani:fix-qwen3_5_moe-cuda-guards
May 1, 2026
Merged

qwen3_5_moe: guard new cudaMemGetInfo blocks behind EXECUTORCH_BUILD_CUDA#19265
rascani merged 1 commit intopytorch:mainfrom
rascani:fix-qwen3_5_moe-cuda-guards

Conversation

@rascani
Copy link
Copy Markdown
Contributor

@rascani rascani commented May 1, 2026

Summary

#19228 added structured GPU memory tracking to the qwen3_5_moe runner but did not wrap the new cudaMemGetInfo blocks in the existing EXECUTORCH_BUILD_CUDA guard that the rest of the file uses for CUDA-only APIs. The same main.cpp is built for the Metal target where the CUDA runtime headers are not available, so the new blocks failed to compile on macOS:

error: use of undeclared identifier 'cudaMemGetInfo'
    if (cudaMemGetInfo(&free, &total) == cudaSuccess) {

Wrap the three new scoped blocks in #ifdef EXECUTORCH_BUILD_CUDA, matching the existing guard pattern at lines 27, 68, 113, 168, and 184. The stats struct fields they would have populated (gpu_free_before_load_bytes, gpu_free_after_load_bytes, gpu_free_after_generate_bytes, gpu_peak_usage_mb) default to their sentinel values on non-CUDA builds, so the rest of the runner's stats reporting tolerates their absence.

Authored with Claude Code.

Test plan

CI

…CUDA

pytorch#19228 added structured GPU memory tracking to the qwen3_5_moe runner
but did not wrap the new cudaMemGetInfo blocks in the existing
EXECUTORCH_BUILD_CUDA guard that the rest of the file uses for CUDA-only
APIs. The same main.cpp is built for the Metal target where the CUDA
runtime headers are not available, so the new blocks failed to compile
on macOS:

    error: use of undeclared identifier 'cudaMemGetInfo'
        if (cudaMemGetInfo(&free, &total) == cudaSuccess) {

Wrap the three new scoped blocks in #ifdef EXECUTORCH_BUILD_CUDA, matching
the existing guard pattern at lines 27, 68, 113, 168, and 184. The stats
struct fields they would have populated (gpu_free_before_load_bytes,
gpu_free_after_load_bytes, gpu_free_after_generate_bytes, gpu_peak_usage_mb)
default to their sentinel values on non-CUDA builds, so the rest of the
runner's stats reporting tolerates their absence.

Authored with Claude Code.
@rascani rascani requested a review from Gasoonjia May 1, 2026 21:07
@rascani rascani requested a review from lucylq as a code owner May 1, 2026 21:07
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 1, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19265

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 1 Cancelled Job, 14 Pending, 4 Unrelated Failures

As of commit da9af5b with merge base a7e44bf (image):

NEW FAILURE - The following job has failed:

CANCELLED JOB - The following job was cancelled. Please retry:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@rascani rascani merged commit a3dd0fa into pytorch:main May 1, 2026
218 of 239 checks passed
@rascani rascani deleted the fix-qwen3_5_moe-cuda-guards branch May 1, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/metal ciflow/mlx CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants